#ifndef TREEWIDGETSHELL_H
#define TREEWIDGETSHELL_H

#include "../../XXqtDefine.h"
#include "../ShellBase.h"
#include <QTreeWidgetItem>
#include <QTreeWidget>
#include <QJsonObject>

class TreeWidgetShell : public QObject{
    Q_OBJECT
public:
    TreeWidgetShell(QObject *parent = nullptr);

    void shell(QTreeWidget *treeWidget);
    void configColumn(const QStringList &key);

    void setData(const QList<QVariant> &data);
    QVariantMap getSectionData(int section);
    QList<QVariant> getRowData(int section);
    QVariant getRowData(int section, int row);

    Q_SIGNAL void sigClicked(int section, int row, int col);

private:
    Q_SLOT void treeWidget_onItemClicked(QTreeWidgetItem *item, int column);

private:
    QList<QVariant> _data;
    QTreeWidget *_treeWidget;
    QStringList _columnKey;
};

#endif
